package com.yehun.dao.impl;

import com.yehun.dao.UserDao;
import com.yehun.entity.User;
import com.yehun.mapper.UserMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class UserDaoImpl implements UserDao {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> list() {
        return userMapper.list();
    }

    @Override
    public List<User> listByRoleId(int roleId) {
        return userMapper.listByRoleId(roleId);
    }

    @Override
    public User get(int id) {
        return userMapper.get(id);
    }

    @Override
    public User getByUserId(String userId) {
        return userMapper.getByUserId(userId);
    }

    @Override
    public User getByEmail(String email) {
        return userMapper.getByEmail(email);
    }

    @Override
    public int save(User user) {
        return userMapper.save(user);
    }

    @Override
    public int updateRole(String userId, int roleId, String roleName) {
        return userMapper.updateRole(userId, roleId, roleName);
    }

    @Override
    public int updatePermission(String userId, Long permission) {
        return userMapper.updatePermission(userId, permission);
    }

    @Override
    public int remove(int id) {
        return userMapper.remove(id);
    }

    @Override
    public int removeBatch(Integer[] idArray) {
        return userMapper.removeBatch(idArray);
    }
}
